package com.molichuxing.services.property;

/**
 * 广告位置类型
 * @author liyg
 *
 */
public enum AdvertPositionEnum {

	/**
     * 终端屏保广告
     */
	TERMINAL(1, "智能终端屏保"),
	
	
	/**
     * APP开机广告
     */
	APP(2, "APP开机广告");

	Integer value;
    String name;

    AdvertPositionEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public Integer getValue() {
        return value;
    }

    public String getName() {
        return name;
    }


    /**
     * 通过value获取枚举的name
     *
     * @param value
     * @return
     */
    public static String getName(Integer value) {
    	if(value == null) {
    		return null;
    	}
        AdvertPositionEnum enumerate = getEnum(value);
        return enumerate == null ? null : enumerate.getName();
    }

    /**
     * 通过value获取枚举
     *
     * @param value
     * @return
     */
    public static AdvertPositionEnum getEnum(Integer value) {
        for (AdvertPositionEnum enumerate : AdvertPositionEnum.values()) {
            	if(enumerate.getValue() == value ){
            		 return enumerate;
            	}
        }
        return null;
    }
	    
}
